import Base_axios from "./base_axios";

// console.log(process.env.NODE_ENV, 'NODE_ENV')
// console.log(process.env, 'process.env')
export const baseURL = process.env.NODE_ENV === 'development' ? 'http://0.0.0.0:9003/' : 'http://120.55.70.227:9003/';
class Api_parse360 extends Base_axios{
  constructor(opt) {
    super(opt.$axios, baseURL);
    // this.suggest = this.suggest.bind(this);
  }

  /**
   * 搜索提示列表
   * @param kw
   * @returns {*}
   */
  suggest(kw) {
    return this.base_get('parse360/suggest', {
      params: {
        kw
      }
    })
  }

  /**
   * 获取热词列表
   * @returns {*}
   */
  hotquery() {
    return this.base_get('parse360/hotquery', {
      params: {}
    })
  }

  /**
   * 搜索列表列表
   * @param kw
   * @param is_info
   * @returns {*}
   */
  search(kw, is_info) {
    return this.base_get('parse360/search', {
      params: {
        kw,
        is_info: is_info || false,
      }
    })
  }

  /**
   * 获取全部类别 parse360/category_type?category=serial
   * @param category
   * @returns {*}
   */
  category_type(category) {
    return this.base_get('parse360/category_type', {
      params: {
        category: category || 'serial'
      }
    })
  }

  /**
   * 获取全部类别列表 parse360/category_list?type=film&rank=rankhot&year=all&area=all&category=all&act=邓超&page=1
   * @param type
   * @param rank
   * @param year
   * @param area
   * @param category
   * @param act
   * @param page
   * @returns {*}
   */
  category_list(type,rank,year,area,category,act,page) {
    return this.base_get('parse360/category_list', {
      params: {
        type: type || 'film',
        rank,
        year,
        area,
        category,
        act,
        page,
      }
    })
  }

  /**
   * 获取视频详情 parse360/info?url=https://www.360kan.com/m/hqfiYxH6QXX2Sh.html
   * @param url
   * @returns {*}
   */
  info(url) {
    return this.base_get('parse360/info', {
      params: {
        url: url
      }
    })
  }

  /**
   * 相关视频、花絮、游戏播放（播放） parse360/about?url=https://www.360kan.com/tv/QrZpbH7lSmbuOH.html
   * @param url
   * @returns {*}
   */
  about(url) {
    return this.base_get('parse360/about', {
      params: {
        url: url
      }
    })
  }


}

export default Api_parse360;
